From 5c720baffc6516596653115d3e8735dd13b39a0a Mon Sep 17 00:00:00 2001 From: robertl Date: Fri, 20 Aug 2004 02:57:52 +0000 Subject: [PATCH] Add LAT_NMEA and LON_NMEA to csv styles. --- gpsbabel/csv_util.c | 12 ++++++++++++ gpsbabel/style/README.style | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/gpsbabel/csv_util.c b/gpsbabel/csv_util.c index 20899f080..6330ff33f 100644 --- a/gpsbabel/csv_util.c +++ b/gpsbabel/csv_util.c @@ -636,6 +636,9 @@ xcsv_parse_val(const char *s, waypoint *wpt, const field_map_t *fmp) if ( strcmp(fmp->key, "LAT_HUMAN_READABLE") == 0) { human_to_dec( s, &wpt->latitude, &wpt->longitude ); } else + if ( strcmp(fmp->key, "LAT_NMEA") == 0) { + wpt->latitude = ddmm2degrees(wpt->latitude); + } else /* LONGITUDE CONVERSIONS ***********************************************/ if (strcmp(fmp->key, "LON_DECIMAL") == 0) { /* longitude as a pure decimal value */ @@ -653,6 +656,9 @@ xcsv_parse_val(const char *s, waypoint *wpt, const field_map_t *fmp) if ( strcmp(fmp->key, "LON_HUMAN_READABLE") == 0) { human_to_dec( s, &wpt->latitude, &wpt->longitude ); } else + if ( strcmp(fmp->key, "LON_NMEA") == 0) { + wpt->latitude = ddmm2degrees(wpt->longitude); + } else /* LAT AND LON CONVERSIONS ********************************************/ if ( strcmp(fmp->key, "LATLON_HUMAN_READABLE") == 0) { human_to_dec( s, &wpt->latitude, &wpt->longitude ); @@ -950,6 +956,9 @@ xcsv_waypt_pr(const waypoint *wpt) if (strcmp(fmp->key, "LAT_HUMAN_READABLE") == 0) { dec_to_human( buff, fmp->printfc, "SN", wpt->latitude ); } else + if (strcmp(fmp->key, "LAT_NMEA") == 0) { + sprintf(buff, fmp->printfc, degrees2ddmm(wpt->latitude)); + } else /* LONGITUDE CONVERSIONS*********************************************/ if (strcmp(fmp->key, "LON_DECIMAL") == 0) { @@ -982,6 +991,9 @@ xcsv_waypt_pr(const waypoint *wpt) dec_to_human( buff+strlen(buff), fmp->printfc, "WE", wpt->longitude ); } else + if (strcmp(fmp->key, "LON_NMEA") == 0) { + sprintf(buff, fmp->printfc, degrees2ddmm(wpt->longitude)); + } else /* DIRECTIONS *******************************************************/ if (strcmp(fmp->key, "LAT_DIR") == 0) { diff --git a/gpsbabel/style/README.style b/gpsbabel/style/README.style index e8bdb047e..b013e04ce 100644 --- a/gpsbabel/style/README.style +++ b/gpsbabel/style/README.style @@ -290,6 +290,18 @@ The fields used by the XCSV parser are as follows: to the letter "n" in "min" and the letter "e" in "deg." example: IFIELD LAT_HUMAN_READABLE,"","%d %d %f%c" (writes 31 40 00.000N) + o LAT_NMEA + Defines the latitude in the format used by the NMEA standard which is + degrees multiplied by 100 plus decimal minutes. + + example: IFIELD LAT_NMEA, "%f", "%08.3f" (writes 3558.322) + + o LON_NMEA + Defines the longitude in the format used by the NMEA standard which is + degrees multiplied by 100 plus decimal minutes. + + example: IFIELD LON_NMEA, "%f", "%010.3f" (writes -08708.082) + o LON_HUMAN_READABLE See LAT_HUMAN_READABLE except LON_HUMAN_READABLE defines LONGITUDE. -- 2.30.2